package com.webianks.hatkemessenger.services;

import android.app.IntentService;
import android.content.ContentValues;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;

/**
 * Created by R Ankit on 29-12-2016.
 */

public class DetelSMSService extends IntentService {

    public DetelSMSService() {
        super("UpdateSMSReceiver");
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        markSmsRead(intent.getLongExtra("id", -123));
    }

    public void markSmsRead(long messageId) {

        try {
//            ContentValues cv = new ContentValues();
//            cv.put("read", "1");
//            getContentResolver().update(Uri.parse("content://sms/" + messageId), cv, null, null);
            getContentResolver().delete(Uri.parse("content://sms/"), "_id=" + messageId, null);// 读取完短信内容后删除
        } catch (Exception e) {
            Log.e("8888", "xx"+e);

        }


    }

}
